package vistop.datatypes;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;

public class Data {
	private HashMap<Integer,Vertex> vertices;
	private HashMap<Integer,Edge> edges;
	private HashMap<Integer,Face> faces;
	private HashMap<Integer, Volume> volumes;
	
	private List<Volume> volumeList;
	
	public Data() {
		this.vertices = new HashMap<Integer,Vertex>();
		this.edges = new HashMap<Integer, Edge>();
		this.faces = new HashMap<Integer, Face>();
		this.volumes = new HashMap<Integer, Volume>(); 
		this.volumeList = new ArrayList<Volume>();
	}
	
	public HashMap<Integer,Vertex> getVertices() {
		return this.vertices;
	}
	
	public void addVertex(Vertex v) {
		if (!vertices.containsKey(v.getId())) {
			vertices.put(v.getId(), v);
			//System.out.println("Adding vertex " + v.toString());
		}
	}
	
	public HashMap<Integer,Edge> getEdges() {
		return this.edges;
	}
	
	public void addEdge(Edge e) {
		if (!edges.containsKey(e.getId())) {
			edges.put(e.getId(), e);
			//System.out.println("Adding edge " + e.toString());
		}
	}
	
	public HashMap<Integer,Face> getFaces() {
		return this.faces;
	}
	
	public void addFace(Face f) {
		if (!faces.containsKey(f.getId())) {
			faces.put(f.getId(), f);
		}
	}
	
	public HashMap<Integer, Volume> getVolumes() {
		return this.volumes;
	}
	
	public void addVolume(Volume v) {
		if (!volumes.containsKey(v.getId())) {
			this.volumes.put(v.getId(), v);
		}
	}
	
	public String toString(){
		String str = "";
		for (Entry<Integer, Volume> e : volumes.entrySet()) {
			str += e.getValue().toString() + "\n";
		}		
		return str;
	}
}
